import { UserConfig } from 'vite'
import path from 'path'
var fs = require('fs')
import { VitePWA } from 'vite-plugin-pwa'
import vue from '@vitejs/plugin-vue'

const config:UserConfig = ({
  resolve:{
    alias:{
      '@': path.resolve(__dirname,'src'),
      '@img':path.resolve(__dirname,'src/assets/img')
    }
  },
  server:{
    https:{
        key:fs.readFileSync(path.join(__dirname, './cert/privatekey.pem')),
        cert: fs.readFileSync(path.join(__dirname, './cert/certificate.pem')),
        ca: fs.readFileSync(path.join(__dirname,'./cert/privateKey.pem'))
    }
  },
  plugins: [
    vue(),
    VitePWA({
      strategies: 'injectManifest',
      manifest:{
        name: "vite-pwa",
        short_name: "vite-pwa",
        start_url: ".",
        background_color: "red",
        theme_color: "white",
        display: "standalone" 
      }
    })
  ]
})

export default config
